<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/jsp/component/common.jsp" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge" ></meta>
    <title>详细内容</title>
    <link rel="stylesheet" href="${frames}/css/lib/bootstrap.min.css" type="text/css" type="text/css">
    <link rel="stylesheet" href="${frames}/css/lib/bootstrap-datetimepicker.min.css" type="text/css">
    <link rel="stylesheet" href="${newframe}/css/base/base.css" type="text/css">
    <link rel="stylesheet" href="${newframe}/css/common.css" type="text/css">
    <link rel="stylesheet" href="${frames}/css/picker.css" type="text/css">
    <link rel="stylesheet" href="${newframe}/css/select2.min.css" type="text/css">
    <link rel="stylesheet" href="${newframe}/css/beautify-time.css" type="text/css">
    <link rel="stylesheet" href="${assets}/css/views/department/addDepartment.scss">

    <%@ include file="/WEB-INF/jsp/component/commonBottom.jsp" %>
    <script src="${frames}/laydate/laydate.dev.js"></script>
    <script src="${assets}/bootstrapValidator/js/bootstrapValidator.js"></script>
    <script src="${assets}/bootstrapValidator/js/language/zh_CN.js"></script>
    <script src="${newframe}/js/select2.full.zh.js"></script>
    <style>
        *{
            padding:0;
            list-style: none;
            text-decoration: none;
            font-weight:100;
            font-family:"微软雅黑";
        }
        body{
            height:auto;
        }
        span,label{
            font:15px/15px 微软雅黑;
            display:inline-block;
        }
        b{
            font-weight:600 !important;
            color:black;
            line-height:60px !important;
        }
        body{
            margin-left:15px;
        }
        h4{
            font:22px/34px 微软雅黑;
            color:black;
        }
        h3{
            font:22px/22px 微软雅黑;
            margin-top:0px;
            color:black;
            margin-bottom:20px;
        }
        body{
            width:768px;
            margin:0 auto;
            overflow:hidden;
        }
        /* 第二部分 最后检验 信息 */
        .text{
            width:100%;
        }
        .title{
            line-height:25px;
            font-size:16px;
            color:#666666;
            margin-left:10px;
        }
        .title1{
            line-height:25px;
            font-size:15px;
            color:#666666;
            margin-left:17px;
            margin-top:5px;
        }
        .text_content{
            margin:20px 0;
            margin-left:18px;
        }
        .text_content div{
            width:48%;
            text-align: left;
            display: inline-block;
        }
        .text_number{
            color:#666666;
            margin-left:20px;
        }
        /*thead hr{*/
        /*border-top: none !important;*/
        /*border-bottom: none !important;*/
        /*}*/
        .news{
            width:95%;
        }
        .feritin input{
            width:20px;
            height:20px;
            background:white;
            vertical-align: middle;
            margin-bottom:7px;
        }
        input[type=checkbox] {
            -webkit-appearance: none;
            border-radius:5px;
            border:1px solid #9e9e9e;
        }
        input[type=checkbox]:checked{
            background-image: url('../assets/images/radio.png');
            background-size:100% 100%
        }
        .ill1{
            width:22%;
            display:inline-block;
        }
        .test{
            width:100%;
            overflow:hidden;
        }
        .test p{
            width:100%;
            line-height:100px;
            font-size:15px;
            text-align:center;
        }
        #change{
            position:fixed;
            bottom:16px;
            right:16px;
        }
        label{
            margin-left:5px;
        }
        .text_number input{
            border:1px solid #d0d0d0;
            width:135px;
            height:30px;
        }
        .change{
            position:fixed;
            top:60%;
            width:100%;
        }
        .btn{
            width:100px;
            line-height: 15px;
            background: #35acfd;
            color: white;
            margin-top:15px;
        }
        .modal-footer{
            width:255px;
            margin:0 auto;
        }
        #keep{
            background:#35acfd !important;
        }
        h1{
            font-family: MicrosoftYaHei;
            font-size: 20px;
            font-weight: normal;
            color: #2a3137;
            margin-bottom: 26px;
            float: left;
        }
        input[type=radio] {
            -webkit-appearance: none;
            border-radius:50%;
            background-image: url('../assets/images/nocheck.png');
            background-size:100% 100%
        }
        input[type=radio]:checked{
            background-image: url('../assets/images/checkout.png');
            background-size:100% 100%
        }
        .feritin div:nth-child(1) .types{
            width:130px;
        }
        .feritin div:nth-child(1) .types label{
            margin-left:2px;
            padding-right:20px;
        }
    </style>
    <script>
           function keep(){
               var url = location.search.split('?')
               var href = url[1].split('&')[1].split('=')[1]
               var type = url[1].split('&')[2].split('=')[1]
               // 获取当前选中的数据
               var bsComplication = $("#bgillness input");
               var bsComplicationjson = []
               for( var a = 0 ; a < bsComplication.length; a++ ){
                   if( bsComplication[a].checked ){
                       bsComplicationjson.push(a+1)
                   }
               }
               var bstype = []
               var bstypearr = $("#classillness input")
               for( var a = 0 ; a < bstypearr.length; a++ ){
                   if( bstypearr[a].checked ){
                       bstype.push(a+1)
                   }
               }
               var idcard = '${entity.idcard}'
               var bsComp = String(bsComplicationjson)
               var bsType = String(bstype)

               $.ajax({
                   url:"${URL_PATIENT_UPDATEBGINFO}",
                   dataType:"json",
                   type:"post",
                   data:{
                       id:${entity.id},
                       bsComplication:bsComp,
                       bsType:bsType
                   },
                   success:function(data){
                       if( data.success ){
                           // 刷新当前页面
                           parent.showSrc('${URL_PATIENT_TOARCHIVES}?idCard=' + idcard+'&diseasesType='+href+'&type='+type)
                           window.parent.simpleCloseModal();
                       }
                   }
               })
           }
    </script>
</head>
<body>
    <div class="header">
        <h1>糖尿病信息</h1>
    </div>
    <div class="change">
        <div class="form-group submitBtn" style="text-align: center ">
            <button type="button" class="btn" data-dismiss="modal" id="closeModalButt" onclick="closeFrame()">
                关闭
            </button>
            <button type="submit" class="btn" id="keep"  onclick="keep()" style="margin-left:20px;">保存</button>
        </div>
    </div>
    <div class="test">
        <span style="width:5px;padding-bottom:25px;background-color:#35acfd;display:inline-block;vertical-align:middle"></span>
        <span class="title">糖尿病信息</span>
        <div class="feritin">
            <div style="margin-top:10px;" id="classillness">
                <span class="title1" style="color:#a9a9a9;margin-right:40px;">糖尿病类型</span>
                <span class="types"  style="margin-left:15px;">
                    <input type="radio" value="0" name="class" id="tn1">
                    <label for="tn1">Ⅰ型</label>
                </span>
                <span class="types">
                    <input type="radio" value="1" name="class" id="tn2">
                    <label for="tn2">Ⅱ型</label>
                </span>
                <span class="types">
                    <input type="radio" value="2" name="class" id="tn3">
                    <label for="tn3">糖尿病妊娠</label>
                </span>
                <span class="types">
                    <input type="radio" value="3" name="class" id="tn4">
                    <label for="tn4">妊娠糖尿病</label>
                </span>
            </div>
            <div style="width:100%;overflow:hidden;">
                <span class="title1" style="color:#a9a9a9;margin-right:40px;">糖尿病并发症</span>
                <div style="display:inline-block;vertical-align: top;width:75%;" id="bgillness">
                    <span class="ill1">
                        <input type="checkbox" value="冠心病" id="q1"  name="test"/>
                        <label for="q1">冠心病</label>
                    </span>
                    <span class="ill1">
                        <input type="checkbox" value="高血糖" id="q2" name="test" />
                        <label for="q2">高血糖</label>
                    </span>
                    <span class="ill1">
                        <input type="checkbox" value="高血脂" id="q3" name="test" />
                        <label for="q3">高血脂</label>
                    </span>
                    <span class="ill1">
                        <input type="checkbox" value="视网膜病变" id="q4"  name="test" />
                        <label for="q4">视网膜病变</label>
                    </span>
                    <span class="ill1">
                        <input type="checkbox" value="周围神经病变" id="q5"  name="test" />
                        <label for="q5">周围神经病变</label>
                    </span>
                    <span class="ill1">
                        <input type="checkbox" value="足部病变" id="q6"  name="test"/>
                        <label for="q6">足部病变</label>
                    </span>
                    <span class="ill1">
                        <input type="checkbox" value="脑卒中" id="q7"  name="test"/>
                        <label for="q7">脑卒中</label>
                    </span>
                    <span class="ill1" style="width:30% !important;">
                        <input type="checkbox" value="冠心病(心肌梗塞)" id="q8" />
                        <label for="q8">冠心病(心肌梗塞)</label>
                    </span>
                </div>
            </div>
        </div>
        <p class="message" style="width:100%;text-align:center;color:red;display:none;">请选择并发症!</p>
    </div>
    <script>
        function closeFrame() {
            window.parent.simpleCloseModal();
        }
        // 初始化显示
        function check(i){
            // 判断血压并发症
            var Input = $("#bgillness input");
            $(Input[i-1]).attr("checked","checked")
        }
        $(function(){
            // 初始化显示血糖并发症
            var bsComplication = '${entity.bsComplication}';
            // 判断并发症
            if( bsComplication == ""){
                // 没有选择
                return false
            } else if( bsComplication.length === 1 ){
                // 当只选择一种并发症
                check(bsComplication)
            }else if( bsComplication.length === 3 ){
                // 当选择两种并发症
                check(bsComplication[0])
                check(bsComplication[2])
            }else if( bsComplication.length === 5 ){
                // 当选择三种并发症
                check(bsComplication[0])
                check(bsComplication[2])
                check(bsComplication[4])
            }else if( bsComplication.length === 7 ){
                // 当选择四种并发症
                check(bsComplication[0])
                check(bsComplication[2])
                check(bsComplication[4])
                check(bsComplication[6])
            }else if( bsComplication.length === 9 ){
                // 当选择五种并发症
                check(bsComplication[0])
                check(bsComplication[2])
                check(bsComplication[4])
                check(bsComplication[6])
                check(bsComplication[8])
            }else if( bsComplication.length === 11 ){
                // 当选择六种并发症
                check(bsComplication[0])
                check(bsComplication[2])
                check(bsComplication[4])
                check(bsComplication[6])
                check(bsComplication[8])
                check(bsComplication[10])
            }else if( bsComplication.length === 13 ){
                // 当选择七种并发症
                check(bsComplication[0])
                check(bsComplication[2])
                check(bsComplication[4])
                check(bsComplication[6])
                check(bsComplication[8])
                check(bsComplication[10])
                check(bsComplication[12])
            }else if( bsComplication.length === 15 ){
                // 当选择七种并发症
                check(bsComplication[0])
                check(bsComplication[2])
                check(bsComplication[4])
                check(bsComplication[6])
                check(bsComplication[8])
                check(bsComplication[10])
                check(bsComplication[12])
                check(bsComplication[14])
            }
            var bsType = '${entity.bsType}';

            if( bsType == null ){

            }else if( bsType === '2' ){
                $("#tn2").attr("checked","checked")
            }else if( bsType === '1' ){
                $("#tn1").attr("checked","checked")
            }else if( bsType === '3' ){
                $("#tn3").attr("checked","checked")
            }else if( bsType === '4' ){
                $("#tn4").attr("checked","checked")
            }
        })
    </script>

</body>
</html>

